< previous page page_398 next page >

Page 398
LISTING 14.2.CMDBTN.HTMADDING AND THEN USING A COMMAND BUTTON ON A WEB PAGE.

8694cbadb9b1ef7075903f6f95fc1db2.gif
<HTML>
<HEAD>
<SCRIPT LANGUAGE=VBScript>
<!--
Sub Command1_OnClick()
    MsgBox Hello World!
End Sub
-->
</SCRIPT>
<FORM>
    <INPUT NAME=Command1 TYPE=BUTTON VALUE=Say Hello!>
</FORM>
</HEAD>
</HTML>

Now that you've seen how to work with a simple VBScript Web page, you need to modify the HTML page you just created. The code in Listing 14.3 shows how to add a text box and command button to the Web page and then have a subroutine executed whenever users click the command button.
LISTING 14.3.HTMLCODE.HTMA COMPLETE VBSCRIPT APPLICATION ON A WEB PAGE.

8694cbadb9b1ef7075903f6f95fc1db2.gif
<HTML>
<HEAD>
<TITLE>VBScript Demonstration Page</TITLE>
<SCRIPT LANGUAGE=VBScript>
<!--
Option Explicit

Sub SayHello(InputName)
    Dim Reply

    Reply = MsgBox(Hello  & InputName & , are you ready to compute?, 36)

    If Reply = 6 Then
        MsgBox Okay, Let's see what we can do!, 64
    Else
        MsgBox This function has been canceled, 64
    End If

End Sub

Sub Command1_OnClick()
    SayHello Form1.Text1.Value
End Sub
-->

 
< previous page page_398 next page >

If you like this book, buy it!